import { VantResolver } from '@vant/auto-import-resolver';
import vue from '@vitejs/plugin-vue';
import path from 'path';
import Components from 'unplugin-vue-components/vite';
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
	plugins: [
		vue(),
		Components({
			resolvers: [VantResolver()],
		}),
	],
	css: {
		preprocessorOptions: {
			scss: {
				// SCSS 文件的全局变量和 mixins
				// 符合原生 css 规则的文件，应该在 main.ts 中引入
				additionalData: `
              @import "@/css/variables";
              @import "@/css/mixins";
            `,
			},
		},
	},
	resolve: {
		alias: {
			// 设置 SCSS 路径别名
			'@': path.resolve(__dirname, 'src/assets'),
		},
	},
});
